package com.lagou.sort;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class SortMapper extends Mapper<Object,Text,IntWritable,IntWritable> {
    IntWritable number = new IntWritable();
    @Override
    protected void map(Object key, Text value, Context context) throws IOException, InterruptedException {
        //获取每一行的值
        String line=value.toString();
        number.set(Integer.parseInt(line));
        //key为number，value为1
        context.write(number, new IntWritable(1));
    }

}
